package licode.unisop.oidc.authsa.service;

import cn.dev33.satoken.dao.SaTokenDao;
import licode.unisop.oidc.auth.gateway.AuthorCache;

import java.util.List;

/**
 * sa-token存储类代理实现
 *
 * @author licode
 */
public class SaTokenDaoProxy implements SaTokenDao {
    private final AuthorCache authorCache;

    public SaTokenDaoProxy(AuthorCache authorCache) {
        this.authorCache = authorCache;
    }

    @Override
    public String get(String key) {
        return authorCache.get(key);
    }

    @Override
    public void set(String key, String value, long timeout) {
        authorCache.set(key, value, timeout);
    }

    @Override
    public void update(String key, String value) {
        authorCache.update(key, value);
    }

    @Override
    public void delete(String key) {
        authorCache.delete(key);
    }

    @Override
    public long getTimeout(String key) {
        return authorCache.getTimeout(key);
    }

    @Override
    public void updateTimeout(String key, long timeout) {
        authorCache.updateTimeout(key, timeout);
    }

    @Override
    public Object getObject(String key) {
        return authorCache.getObject(key);
    }

    @Override
    public void setObject(String key, Object object, long timeout) {
        authorCache.setObject(key, object, timeout);
    }

    @Override
    public void updateObject(String key, Object object) {
        authorCache.updateObject(key, object);
    }

    @Override
    public void deleteObject(String key) {
        authorCache.deleteObject(key);
    }

    @Override
    public long getObjectTimeout(String key) {
        return authorCache.getObjectTimeout(key);
    }

    @Override
    public void updateObjectTimeout(String key, long timeout) {
        authorCache.updateObjectTimeout(key, timeout);
    }

    @Override
    public List<String> searchData(String prefix, String keyword, int start, int size, boolean sortType) {
        return null;
    }
}
